package com.maimao.model.goods;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import javax.annotation.Nullable;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author MaoLin Wang
 * @date 2020/11/27 11:22 下午
 */
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("mm_goods")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Goods implements Serializable {

    private static final long serialVersionUID = 9054861717096772074L;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;


    @NotBlank(message = "请填写宝贝名称")
    @TableField(value = "`name`")
    private String name;

    @NotBlank(message = "请填写宝贝副标题")
    @TableField(value = "sub_name")
    private String subName;

    @NotNull(message = "请填写宝贝品牌")
    @TableField(value = "brand_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long brandId;

    @NotNull(message = "请选择宝贝一级类目")
    private Integer cid1;

    @NotNull(message = "请选择宝贝二级类目")
    private Integer cid2;

    @NotNull(message = "请选择宝贝三级类目")
    private Integer cid3;

    @NotNull(message = "请选择宝贝上架状态")
    @TableField(value = "on_sell")
    private Integer onSell;

    /**
     * 1有效/已审核 0 无效(审核未通过) 2 待审核(第一次发布) 3 待审核（商品修改）
     */
    @TableField(value = "`status`")
    private Integer status;

    @TableField(value = "click_count")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long clickCount;

    @NotBlank(message = "请填写宝贝关键词")
    private String keywords;

    private Integer recommend;

    private Integer hot;

    @TableField(value = "sell_count")
    private Integer sellCount;

    /**
     * 默快递配送方式id
     */
    @NotNull(message = "请选择宝贝配送快递")
    @TableField(value = "express_id")
    private Integer expressId;

    /**
     * 店内排序
     */
    @TableField(value = "`order`")
    private Integer order;

    /**
     * 店铺id
     */
    @TableField(value = "shop_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long shopId;

    @TableField(exist = false)
    private String shopName;

    @TableField(value = "min_price")
    private BigDecimal minPrice;

    @TableField(value = "create_time")
    private LocalDateTime createTime;

    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    @TableField(value = "delete_time")
    private LocalDateTime deleteTime;

    @Override
    public String toString() {
        return "Goods{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", subName='" + subName + '\'' +
                ", brandId=" + brandId +
                ", cid1=" + cid1 +
                ", cid2=" + cid2 +
                ", cid3=" + cid3 +
                ", onSell=" + onSell +
                ", status=" + status +
                ", clickCount=" + clickCount +
                ", keywords='" + keywords + '\'' +
                ", recommend=" + recommend +
                ", hot=" + hot +
                ", sellCount=" + sellCount +
                ", expressId=" + expressId +
                ", order=" + order +
                ", shopId=" + shopId +
                ", shopName='" + shopName + '\'' +
                ", minPrice=" + minPrice +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", deleteTime=" + deleteTime +
                '}';
    }
}
